/******************************************************************************
**                                                                           **
**                 Proprietary and Confidential Information                  **
**                                                                           **
**                 Copyright (c) SigmaTel, Inc. Unpublished                  **
**                                                                           **
** This source code and the algorithms implemented therein constitute        **
** confidential information and may compromise trade secrets of SigmaTel,    **
** Inc. or its associates, and any unauthorized use thereof is prohibited.   **
**                                                                           **
******************************************************************************/

#ifndef __dmbbufio_h__
#define __dmbbufio_h__

//
// WARNING ... this module is only in pre-infancy stage.  Please do not use
// as APIs are likely to change.
//

//
// This module is meant to provide an easy way to transfer IMGBUF type images
// between firmware and dbgmon PC filesystem.  It will understand standard
// IMGBUF image attributes, and perform appropriate mapping as image data is
// read/write from files on PC.
//

typedef enum {
  DMBBUFIO_MODE_DumpFromFirmware,
  DMBBUFIO_MODE_LoadToFirmware
} DMBBUFIO_MODE_t;

typedef struct 
{

  DMBBUFIO_MODE_t mode;

  FILE *fp;
  FILE *fp_desc;

  int nBytes;
  int nLines;


} DMBBUFIO_t;

CPP DBGMON_API int DMBBUFIO_DumpFromFirmware_Open
( DMBBUFIO_t *dmbbufio,
  char *clientInfo,
  char *fileNamePrefix,
  char *options );

CPP DBGMON_API int DMBBUFIO_LoadToFirmware_Open
( DMBBUFIO_t *dmbbufio,
  char *clientInfo,
  char *filename,
  char *options );

CPP DBGMON_API int DMBBUFIO_TransferData
( DMBBUFIO_t *dmbbufio,
  UINT32 *nBytes,
  UINT32 nLines,
  void **segmentBase,
  UINT32 *segmentBytes );
  
CPP DBGMON_API int DMBBUFIO_Close
( DMBBUFIO_t *dmbbufio );

#endif
